package com.atguigu.wordcount.sort;

import org.apache.hadoop.io.WritableComparator;

/**
 * @ClassName MySort
 * @DeScription MySort
 * @Author 剧情再美终是戏
 * @Date 2019/11/19 9:30
 * @Version 1.0
 **/
public class MySort extends WritableComparator {

    @Override
    public int compare(byte[] b1, int s1, int l1,
                       byte[] b2, int s2, int l2) {
        long thisValue = readLong(b1, s1);
        long thatValue = readLong(b2, s2);
        return (thisValue < thatValue ? 1 : (thisValue == thatValue ? 0 : -1));
    }
}
